#!/bin/bash

source /etc/profile

workdir=$(cd $(dirname $0); pwd)
source $workdir/config.cfg

$workdir/../sync/sync_one.sh t_product 6
$workdir/../sync/sync_one.sh t_user 200
$workdir/../sync/sync_one.sh t_order 100
$workdir/../sync/sync_one.sh t_user_label 20
$workdir/../sync/sync_one.sh t_virtual_pay_order 500
$workdir/../sync/sync_one.sh t_money_details 50
$workdir/../sync/sync_one.sh t_guild_member 10
$workdir/../sync/sync_part_today.sh

beeline -u "${hive_url}" -n bi-report -f $workdir/dws/user.sql
beeline -u "${hive_url}" -n bi-report -f $workdir/dws/recharge_order.sql
beeline -u "${hive_url}" -n bi-report -f $workdir/dws/consumer_order.sql

$workdir/conc_exec_sql.sh $workdir/temp/realtime realtime

beeline -u "${hive_url}" -n bi-report -f $workdir/report/new_range_pay_stat.sql

beeline -u "${hive_url}" -n bi-report -f $workdir/copy_table/new_range_pay_stat_day.sql

sqoop eval --connect "jdbc:mysql://${bi_db_url}:${bi_db_port}/${bi_db}" --username ${bi_db_username} --password "${bi_db_password}" -e "truncate table t_new_range_pay_stat_day"
sqoop export -D mapred.job.queue.name=root.sync --connect "jdbc:mysql://${bi_db_url}:${bi_db_port}/${bi_db}" --username ${bi_db_username} --password "${bi_db_password}" --table t_new_range_pay_stat_day \
  --fields-terminated-by '\001' --lines-terminated-by '\n' --export-dir "/user/hive/warehouse/bi_report.db/new_range_pay_stat_day"




